package com.wu.util.spider.service;

import com.wu.util.spider.entity.RecordBaseEntity;

import java.io.*;
import java.util.List;

/**
 * @author xwu36
 */
public abstract class BaseSaveWorkerService {

    protected  void baseSaveImage(InputStream inputStream,File file) throws IOException {
        byte[] data = new byte[1024 * 10];
        int length = 0;
        OutputStream outputStream = new FileOutputStream(file);
        // 采用多次read的方式
        while ((length = inputStream.read(data)) != -1) {
            outputStream.write(data, 0, length);
        }
        outputStream.flush();
        outputStream.close();
        inputStream.close();
    }

    private void baseSaveTxt(List<RecordBaseEntity> list, File file){

    }

    private void baseSaveXls(List<RecordBaseEntity> list, File file){

    }

    private void baseSaveMd(List<RecordBaseEntity> list, File file){

    }


}
